package us.icitap.timsportal.web.custom;

import com.vaadin.data.Property;
import com.vaadin.ui.TextField;

public class PTextField extends TextField{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public PTextField(){
		super();
		this.addStyleName("timsportal");
		this.setNullRepresentation("");
	}

	public PTextField(String caption){
		super(caption);
		this.addStyleName("timsportal");
		this.setNullRepresentation("");
	}
	
	public PTextField(String caption, ValueChangeListener listener){
		super(caption);
		this.addListener(listener);
	}
	
	public PTextField(Property dataSource) {
		super(dataSource);
		this.addStyleName("timsportal");
		this.setNullRepresentation("");
	}

	public PTextField(String caption, Property dataSource) {
		super(caption, dataSource);
		this.addStyleName("timsportal");
		this.setNullRepresentation("");
	}
	
	public PTextField(String caption, String value) {
		super(caption, value);
		this.addStyleName("timsportal");
		this.setNullRepresentation("");
	}
	
	@Override
	public Object getValue() {
		
		if (super.getValue() != null && super.getValue() instanceof String)
			if(super.getValue() instanceof String){
				String s=	(String) super.getValue();
				if(s.isEmpty()==true){
					return null;
				} 
			return super.getValue().toString().trim().toUpperCase();
		
		
		}
		return super.getValue();
	}

}
